package com.ls.rbac.utils;

import jakarta.annotation.Resource;

import net.sf.jsqlparser.statement.select.KSQLWindow;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.time.Duration;


/**
 * created by liush on 2025/6/28
 **/

@Component
public class RedisUtils {

    @Resource
    private StringRedisTemplate stringRedisTemplate;

    public void set(String key, String value) {
        stringRedisTemplate.opsForValue().set(key, value);
    }

    public void set(String key, String value, long outtime) {

        stringRedisTemplate.opsForValue().set(key, value, Duration.ofSeconds(outtime));
    }

    public String get(String key) {
        return stringRedisTemplate.opsForValue().get(key);
    }
    public void delete(String key) {
        stringRedisTemplate.delete(key);
    }
}